<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateSystemNoticeImagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('system_notice_images', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('systemNoticeId')->default(0)->comment('系统公告ID');
            $table->string('image', 255)->default('')->comment('图片');
            $table->unsignedInteger('type')->default(1)->comment('图片类型  1-封面图 2-详情图 ');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->tinyInteger('isDeleted')->default(0)->comment('是否删除');
            $table->collation = 'utf8mb4_general_ci';
            $table->index(['systemNoticeId'], 'idx_systemNoticeId');
            $table->comment = '系统公告附加图片';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('system_notice_images');
    }
}
